# -*- encoding:utf-8 -*-
from mako import runtime, filters, cache
UNDEFINED = runtime.UNDEFINED
__M_dict_builtin = dict
__M_locals_builtin = locals
_magic_number = 5
_modified_time = 1320149005.8823099
_template_filename='/home/kenshuri/c_chrysalide/trunk/portal/portal/templates/dashboard/news/modif_news.mako'
_template_uri='/dashboard/news/modif_news.mako'
_template_cache=cache.Cache(__name__, _modified_time)
_source_encoding='utf-8'
from webhelpers.html import escape
_exports = ['title']


def _mako_get_namespace(context, name):
    try:
        return context.namespaces[(__name__, name)]
    except KeyError:
        _mako_generate_namespaces(context)
        return context.namespaces[(__name__, name)]
def _mako_generate_namespaces(context):
    pass
def _mako_inherit(template, context):
    _mako_generate_namespaces(context)
    return runtime._inherit_from(context, u'/dashboard/site.mako', _template_uri)
def render_body(context,**pageargs):
    context.caller_stack._push_frame()
    try:
        __M_locals = __M_dict_builtin(pageargs=pageargs)
        c = context.get('c', UNDEFINED)
        request = context.get('request', UNDEFINED)
        tr = context.get('tr', UNDEFINED)
        str = context.get('str', UNDEFINED)
        all_news = context.get('all_news', UNDEFINED)
        news = context.get('news', UNDEFINED)
        __M_writer = context.writer()
        # SOURCE LINE 1
        __M_writer(u'\n')
        # SOURCE LINE 2
        __M_writer(u'\n')
        # SOURCE LINE 3

        def print_list_news(news_db):   
                all_news = ''
                
                
                for news in news_db:
                        tr = '<tr>'
                        tr = tr + '<td>'+str(news.id)+'</td>'
                        tr = tr + '<td>' + news.title[:50] + '</td>'
                        tr = tr + '<td><a href="/dashboard/modif_news_id/' + str(news.id) + '">Modifier</a></td>'
                        tr = tr + '</tr>'
                        all_news = all_news + tr
        
                return all_news
        
        
        __M_locals_builtin_stored = __M_locals_builtin()
        __M_locals.update(__M_dict_builtin([(__M_key, __M_locals_builtin_stored[__M_key]) for __M_key in ['print_list_news'] if __M_key in __M_locals_builtin_stored]))
        # SOURCE LINE 17
        __M_writer(u'\n<div style="padding: 20px;">\n\t<div>\n\t')
        # SOURCE LINE 20
        __M_writer(c.message )
        __M_writer(u'\n')
        # SOURCE LINE 21
        if request.params.get('modified') == 'yes':
            # SOURCE LINE 22
            __M_writer(u"\t\t<span class='success_message'>La news a ete correctement modifiee</span>\n")
            # SOURCE LINE 23
        elif request.params.get('modified') == 'no':
            # SOURCE LINE 24
            __M_writer(u"\t\t<span class='error_message'>La news n'a pas ete modifiee - tout les champs sont requit</span>\n")
            pass
        # SOURCE LINE 26
        __M_writer(u'\t</div>\n\t<p>Modifer une news</p>\n\t<table style="font-size: 12px;">\n\t\t<tr style="background: grey; color: white;"><td>ID</td><td style="width: 300px;">Titre</td><td></td></tr>\t\t\n\t\t\n\t\t')
        # SOURCE LINE 31
        __M_writer(print_list_news(c.news) )
        __M_writer(u'\n\t\t\n\t</table>\n</div>\n')
        return ''
    finally:
        context.caller_stack._pop_frame()


def render_title(context):
    context.caller_stack._push_frame()
    try:
        __M_writer = context.writer()
        # SOURCE LINE 2
        __M_writer(u'Dashboard')
        return ''
    finally:
        context.caller_stack._pop_frame()


